package cn.edu.sig.service;


import javax.annotation.Resource;

import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;

import cn.edu.sig.dao.UserDao;

@Service
public class MyUserDetailsService implements UserDetailsService {

	@Resource
	private UserDao userDao;
	
	public UserDetails loadUserByUsername(String name)
			throws UsernameNotFoundException {
		
		/*UserDetails user = (UserDetails) SecurityContextHolder.getContext()
	    .getAuthentication()
	    .getPrincipal();
		
		System.out.println(user.getUsername());*/
		
		return userDao.findUserRole(name);
	}

}
